from urllib import urlencode
from urllib2 import urlopen

import sumc
from sumc.client import Extractor

_defaultParams = {
    'ctl00$ContentPlaceHolder1$ddlLines': '',
    'ctl00$ContentPlaceHolder1$ddlStops': '',
    'ctl00$ContentPlaceHolder1$ddlTransportType': '',
    'ctl00$ContentPlaceHolder1$rblRoute': '',
}

p = Extractor();
res = urlopen('http://gps.skgt-bg.com/Web/SelectByLine.aspx')
p.feed(res.read())
firstHiddens = p.hiddens.copy()

print firstHiddens

for x in xrange(10):
    p.reset()
    res = urlopen('http://gps.skgt-bg.com/Web/SelectByLine.aspx')
    for k, v in p.hiddens:
        if p.hiddens[k] != firstHiddens[k]:
            print 
            print k
            print p.hiddens[k]
            print firstHiddens[k]




#def postAndUpdate(params):
#    l.info("posting")
#    res = urlopen('http://gps.skgt-bg.com/Web/SelectByLine.aspx', urlencode(params))
#
#    data = res.read()
#    hiddens = extractHiddens(data)
#    params.update(**hiddens)
#    return data